package com.logic.landseaserver.domain;

import java.sql.Timestamp;
import java.util.Date;

public class WebankParam {
    private Integer id;
    
    private Integer prjId;

    private String wMerchantId;

    private String wMerchantName;

    private String wMerchantAbbreviation;

    private String qrMerchantId;
    
    private String qrAliMerchantId;

    private String qrMerchantName;

    private String qrMerchantAbbreviation;

    private Integer version;

    private Date createdDtm;

    private Integer createdBy;

    private Date lastModifiedDtm;

    private Integer lastModifiedBy;

    private Boolean deleted;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getPrjId() {
		return prjId;
	}

	public void setPrjId(Integer prjId) {
		this.prjId = prjId;
	}

	public String getwMerchantId() {
        return wMerchantId;
    }

    public void setwMerchantId(String wMerchantId) {
        this.wMerchantId = wMerchantId == null ? null : wMerchantId.trim();
    }

    public String getwMerchantName() {
        return wMerchantName;
    }

    public void setwMerchantName(String wMerchantName) {
        this.wMerchantName = wMerchantName == null ? null : wMerchantName.trim();
    }

    public String getwMerchantAbbreviation() {
        return wMerchantAbbreviation;
    }

    public void setwMerchantAbbreviation(String wMerchantAbbreviation) {
        this.wMerchantAbbreviation = wMerchantAbbreviation == null ? null : wMerchantAbbreviation.trim();
    }

    public String getQrMerchantId() {
        return qrMerchantId;
    }

    public void setQrMerchantId(String qrMerchantId) {
        this.qrMerchantId = qrMerchantId == null ? null : qrMerchantId.trim();
    }

    public String getQrAliMerchantId() {
		return qrAliMerchantId;
	}

	public void setQrAliMerchantId(String qrAliMerchantId) {
		this.qrAliMerchantId = qrAliMerchantId;
	}

	public String getQrMerchantName() {
        return qrMerchantName;
    }

    public void setQrMerchantName(String qrMerchantName) {
        this.qrMerchantName = qrMerchantName == null ? null : qrMerchantName.trim();
    }

    public String getQrMerchantAbbreviation() {
        return qrMerchantAbbreviation;
    }

    public void setQrMerchantAbbreviation(String qrMerchantAbbreviation) {
        this.qrMerchantAbbreviation = qrMerchantAbbreviation == null ? null : qrMerchantAbbreviation.trim();
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Date getCreatedDtm() {
        return createdDtm;
    }

    public void setCreatedDtm(Date createdDtm) {
        this.createdDtm = createdDtm;
    }

    public Integer getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(Integer createdBy) {
        this.createdBy = createdBy;
    }

    public Date getLastModifiedDtm() {
        return lastModifiedDtm;
    }

    public void setLastModifiedDtm(Date lastModifiedDtm) {
        this.lastModifiedDtm = lastModifiedDtm;
    }

    public Integer getLastModifiedBy() {
        return lastModifiedBy;
    }

    public void setLastModifiedBy(Integer lastModifiedBy) {
        this.lastModifiedBy = lastModifiedBy;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }
    public void updateCommonInfo(Integer userId) {

        Timestamp now = new Timestamp(new Date().getTime());
        if (this.getId() == null || this.getId() == 0) { // New PoJo
          this.setVersion(0);
          if (this.getCreatedDtm() == null) {
            this.setCreatedDtm(now);
          }
          if (this.getCreatedBy() == null || this.getCreatedBy().equals(0)) {
            this.setCreatedBy(userId == null ? 0 : userId);
          }
          this.setLastModifiedDtm(now);
          this.setLastModifiedBy(userId == null ? 0 : userId);
          this.setDeleted(false);

        } else { // Update this
          this.setVersion(this.getVersion() == null ? 1 : this.getVersion() + 1);
          this.setLastModifiedDtm(now);
          if (userId.equals(-1)) {
          } else {
            this.setLastModifiedBy(userId == null ? 0 : userId);
          }
        }
      }
    
}